package com.health.tablebean.webservice;

import android.content.Context;

import com.health.NovaApplication;
import com.health.db.FDbManager;
import com.health.tablebean.GRAVIDA_TWO2FIVE_FOLLOWUP;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * 第二到五次产前随访
 * Created by Administrator on 2018/2/23 0023.
 */

public class PrenatalTwo2FiveVisit {

    private String personalid;//		城乡居民健康档案编号
    private String fetusTimes;//		产次，DM06-05_1 第一胎，DM06-05_2 第二胎，DM06-05_3 第三胎，DM06-05_4 第四胎，DM06-05_5 第五胎
    private String visitDate;//		填表日期
    private String gestationWeeks;//		孕周
    private String patientsReport;//)		主诉
    private String fundusUterus;//        宫底高度（cm)
    private String nextVisitDate;//		下次汸视日期
    private String visitDoctorName;//		访视医师姓名
    private String creater;//		创建人
    private String createorg;//		创建机构
    private String abdomenCircumference;//腹部周长的测量值，计量单位为cm
    private String bodyWeight;//体重的测量值，计量单位为kg
    private String dbp;//舒张压（mm Hg)
    private String fetalHr;//	胎心率（次/min)
    private String fetalPosition;//	胎方位代码
    private String haematoglobin;//血红蛋白值（g/L)
    private Rollout hdPersonalRollOut;
    private String maternalHealthDesc;//	孕产妇健康评估异常结果描述
    private String maternalHealthGuide;//	保健指导
    private String maternalHealthOther;//	保健指导 其他
    private String maternalHealthSign;//	孕产妇健康评估异常标志，DM01-40_1 未见异常，DM01-40_2 异常
    private String otherAuxiliaryExamination;//		其他辅助检查
    private String res1;//		标记是否转诊，DM01-11_1 无，DM01-11_2 有
    private String sbp;//        收缩压（mmHg)
    private String urineProteinValue;//		尿蛋白定性检测结果代码
    private String visitTimes;//		随访次数， 1 产前第一次随访 2~5 分别表示产前第2次到第5次随访'

    public String getPersonalid() {
        return personalid;
    }

    public void setPersonalid(String personalid) {
        this.personalid = personalid;
    }

    public String getFetusTimes() {
        return fetusTimes;
    }

    public void setFetusTimes(String fetusTimes) {
        this.fetusTimes = fetusTimes;
    }

    public String getVisitDate() {
        return visitDate;
    }

    public void setVisitDate(String visitDate) {
        this.visitDate = visitDate;
    }

    public String getGestationWeeks() {
        return gestationWeeks;
    }

    public void setGestationWeeks(String gestationWeeks) {
        this.gestationWeeks = gestationWeeks;
    }

    public String getPatientsReport() {
        return patientsReport;
    }

    public void setPatientsReport(String patientsReport) {
        this.patientsReport = patientsReport;
    }

    public String getFundusUterus() {
        return fundusUterus;
    }

    public void setFundusUterus(String fundusUterus) {
        this.fundusUterus = fundusUterus;
    }

    public String getNextVisitDate() {
        return nextVisitDate;
    }

    public void setNextVisitDate(String nextVisitDate) {
        this.nextVisitDate = nextVisitDate;
    }

    public String getVisitDoctorName() {
        return visitDoctorName;
    }

    public void setVisitDoctorName(String visitDoctorName) {
        this.visitDoctorName = visitDoctorName;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    public String getCreateorg() {
        return createorg;
    }

    public void setCreateorg(String createorg) {
        this.createorg = createorg;
    }

    public String getAbdomenCircumference() {
        return abdomenCircumference;
    }

    public void setAbdomenCircumference(String abdomenCircumference) {
        this.abdomenCircumference = abdomenCircumference;
    }

    public String getBodyWeight() {
        return bodyWeight;
    }

    public void setBodyWeight(String bodyWeight) {
        this.bodyWeight = bodyWeight;
    }

    public String getDbp() {
        return dbp;
    }

    public void setDbp(String dbp) {
        this.dbp = dbp;
    }

    public String getFetalHr() {
        return fetalHr;
    }

    public void setFetalHr(String fetalHr) {
        this.fetalHr = fetalHr;
    }

    public String getFetalPosition() {
        return fetalPosition;
    }

    public void setFetalPosition(String fetalPosition) {
        this.fetalPosition = fetalPosition;
    }

    public String getHaematoglobin() {
        return haematoglobin;
    }

    public void setHaematoglobin(String haematoglobin) {
        this.haematoglobin = haematoglobin;
    }

    public Rollout getHdPersonalRollOut() {
        return hdPersonalRollOut;
    }

    public void setHdPersonalRollOut(Rollout hdPersonalRollOut) {
        this.hdPersonalRollOut = hdPersonalRollOut;
    }

    public String getMaternalHealthDesc() {
        return maternalHealthDesc;
    }

    public void setMaternalHealthDesc(String maternalHealthDesc) {
        this.maternalHealthDesc = maternalHealthDesc;
    }

    public String getMaternalHealthGuide() {
        return maternalHealthGuide;
    }

    public void setMaternalHealthGuide(String maternalHealthGuide) {
        this.maternalHealthGuide = maternalHealthGuide;
    }

    public String getMaternalHealthOther() {
        return maternalHealthOther;
    }

    public void setMaternalHealthOther(String maternalHealthOther) {
        this.maternalHealthOther = maternalHealthOther;
    }

    public String getMaternalHealthSign() {
        return maternalHealthSign;
    }

    public void setMaternalHealthSign(String maternalHealthSign) {
        this.maternalHealthSign = maternalHealthSign;
    }

    public String getOtherAuxiliaryExamination() {
        return otherAuxiliaryExamination;
    }

    public void setOtherAuxiliaryExamination(String otherAuxiliaryExamination) {
        this.otherAuxiliaryExamination = otherAuxiliaryExamination;
    }

    public String getRes1() {
        return res1;
    }

    public void setRes1(String res1) {
        this.res1 = res1;
    }

    public String getSbp() {
        return sbp;
    }

    public void setSbp(String sbp) {
        this.sbp = sbp;
    }

    public String getUrineProteinValue() {
        return urineProteinValue;
    }

    public void setUrineProteinValue(String urineProteinValue) {
        this.urineProteinValue = urineProteinValue;
    }

    public String getVisitTimes() {
        return visitTimes;
    }

    public void setVisitTimes(String visitTimes) {
        this.visitTimes = visitTimes;
    }

    public static List<PrenatalTwo2FiveVisit> convertData(Context context, String times) {
        List<PrenatalTwo2FiveVisit> datas = new ArrayList<>();
        FDbManager fdb = FDbManager.getInstance(context);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        List<GRAVIDA_TWO2FIVE_FOLLOWUP> infos = fdb.findAllByWhere(GRAVIDA_TWO2FIVE_FOLLOWUP.class,
                "IS_UPDATE='" + "Y' AND CREATER='" + NovaApplication.getJgrno() + "'AND TIMES='" + times + "'");
        if (infos != null && !infos.isEmpty()) {
            PrenatalTwo2FiveVisit data = null;
            for (GRAVIDA_TWO2FIVE_FOLLOWUP info : infos) {
                data = new PrenatalTwo2FiveVisit();

                data.setPersonalid(info.getARCHIVEID());//		城乡居民健康档案编号
                data.setFetusTimes(info.getFetusTimes());//		产次，DM06-05_1 第一胎，DM06-05_2 第二胎，DM06-05_3 第三胎，DM06-05_4 第四胎，DM06-05_5 第五胎
                data.setVisitDate(formatter.format(info.getFOLLOWUP_DATE()));//		填表日期
                data.setGestationWeeks(info.getPREGANCYWEEKS());//		孕周
                data.setPatientsReport(info.getCHIEFCOMPLAINT());//)		主诉
                data.setFundusUterus(info.getUTERUSLOWHEIGHT());//        宫底高度（cm)
                data.setNextVisitDate(formatter.format(info.getNEXTFOLLOWUP_DATE()));//		下次汸视日期
                data.setVisitDoctorName(info.getFOLLOWUPDOCTOR());//		访视医师姓名
                data.setCreater(info.getCREATER());//		创建人
                data.setCreateorg(info.getCREATEORG());//		创建机构
                data.setAbdomenCircumference(info.getABDOMINALCIRUMFERENCE());//腹部周长的测量值，计量单位为cm
                data.setBodyWeight(info.getWEIGHT());//体重的测量值，计量单位为kg
                data.setDbp(info.getLBLOODPRESSURE());//舒张压（mm Hg)
                data.setFetalHr(info.getFHR());//	胎心率（次/min)
                data.setFetalPosition(info.getFETUSPOSITION());//	胎方位代码
                data.setHaematoglobin(info.getHB());//血红蛋白值（g/L)
                data.setMaternalHealthDesc(info.getCLASSIFICATION_EX());//	孕产妇健康评估异常结果描述
                data.setMaternalHealthGuide(info.getADVISING());//	保健指导
                data.setMaternalHealthOther(info.getADVISINGOTHER());//	保健指导 其他
                data.setMaternalHealthSign(info.getCLASSIFICATION());//	孕产妇健康评估异常标志，DM01-40_1 未见异常，DM01-40_2 异常
                data.setOtherAuxiliaryExamination(info.getASSISTANTEXAM());//		其他辅助检查
                data.setRes1(info.getREFERRAL());//		标记是否转诊，DM01-11_1 无，DM01-11_2 有
                data.setSbp(info.getHBLOODPRESSURE());//        收缩压（mmHg)
                data.setUrineProteinValue(info.getPRO());//		尿蛋白定性检测结果代码
                data.setVisitTimes(info.getTIMES());//		随访次数， 1 产前第一次随访 2~5 分别表示产前第2次到第5次随访'
                Rollout rollout = new Rollout();
                rollout.setRollInRegion(info.getREFERRALORG());
                rollout.setHpc(info.getREFERRALREASON());
                data.setHdPersonalRollOut(rollout);
                datas.add(data);
            }
        }
        return datas;
    }
}
